<?php
class AskControl extends Control{
	public function index(){
		//所有问题 ******************************************
			$sql = "SELECT *FROM hd_ask";
			$allask = M('wenda')->query($sql);
			// var_dump($allask);
			$this->assign('allask',$allask);
			$this->display('ask.html');
		
		




		
	}
// 删除问题方法
	public function del(){
		$asid = htmlspecialchars($_GET['asid']);
		$delsql = "DELETE FROM hd_ask WHERE asid={$asid}";

		$uid =M('wenda')->exe($delsql);

			//判断
			if($uid>0){
			$this->error('删除成功');

			}else{
				$this->error('删除失败');
			}
		// delete from stu_back where sid=12;
	}
public function ask_1(){
	//待解决的问题 ******************************************
			// 组合SQL语句
			$sql1 = "SELECT *FROM hd_ask WHERE solve=0";
			$ask = M('wenda')->query($sql1);
			$this->assign('ask',$ask);
			$this->display('ask_1.html');

}
public function ask_2(){
	//已解决的问题 *******************************************
			$sql1 = "SELECT *FROM hd_ask WHERE solve=1";
			$answer = M('wenda')->query($sql1);
			$this->assign('answer',$answer);
			$this->display('ask_2.html');
}
public function ask_3(){

			//0回答 *******************************************
			$sql3 = "SELECT *FROM hd_ask WHERE answer=0";
			$zero_answer = M('wenda')->query($sql3);
			// var_dump($zero_answer);
			$this->assign('zero_answer',$zero_answer);
			$this->display('ask_3.html');
}

}